<%-- 
    Document   : editStaff
    Created on : Dec 18, 2014, 4:08:52 PM
    Author     : nga
--%>

<%@page import="entity.Staff"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="dao.StaffDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!doctype html>
<%!
    Connection con = null;
    PreparedStatement prst=null;
%>  
<%
    String msg = "";
    Staff sta=StaffDAO.getStaff(request.getParameter("username"));
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    boolean role = Boolean.parseBoolean(request.getParameter("role"));
    Staff newSta=new Staff(username,password,role);  
        if(request.getParameter("save")!=null){
            StaffDAO.edit(newSta);
            response.sendRedirect("listStudents.jsp");
        }         
%>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<h2>Edit Staff</h2>
<p>
  <label for="textfield2">Password:</label>
  <input type="text" name="pass" id="textfield2">
  <label for="textfield3"><br>
    <br>
    Role:</label>
  <input type="text" name="age" id="textfield3">
</p>
<p>
            <input type='submit' name='save' id='save' value='Save'>
            <a href = 'listCategories.jsp'> <input type='button' name='cancel' id='cancel' value='Cancel'></a>
</p>
</body>
</html>

